package com.itheima.service.impl;

import com.itheima.bean.Card;
import com.itheima.mapper.CardMapper;
import com.itheima.service.CardService;
import com.itheima.utils.MapperUtils;

import java.util.List;

public class CardServiceImpl implements CardService {
    @Override
    public List<Card> findAll() {

        try{
            CardMapper mapper = MapperUtils.getMapper(CardMapper.class);
            List<Card> cards = mapper.findAll();
            //MapperUtils.commit();
            return cards;
        }catch(Exception e){
            e.printStackTrace();
        //MapperUtils.rollback();
        }finally {
            MapperUtils.close();
        }

        return null;
    }
}
